home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
GRAPTIES
/
MB111.LZH
/
MB.TP
< prev
next >
Wrap
Text File
|
1988-09-17
|
2KB
|
77 lines
(*
Routines for Interfacing Turbo Pascal* programs with Magic Brush.
Copyright 1988 by Nassib Nassar, All rights reserved
* Turbo Pascal is a registered trademark of Borland International, Inc.
These routines may be used in Turbo Pascal, version 3 or 4.
Example of Usage:
To read a Magic Brush file from disk:
------------------------------------------------------------
{$I MB.TP }
begin { YOUR PROGRAM }
{ Switch to medium-resolution graphics mode here }
if read_mb_pic('FILENAME.MB') <> 0 then
writeln('Error reading file');
end.
------------------------------------------------------------
To write a Magic Brush file to disk:
------------------------------------------------------------
{$I MB.TP }
begin { YOUR PROGRAM }
{ Switch to medium-resolution graphics mode here }
{ Draw picture here }
if write_mb_pic('FILENAME.MB') <> 0 then
writeln('Error writing file');
end.
------------------------------------------------------------
*)
{ ROUTINES FOR READING AND WRITING PICTURE FILES IN MAGIC BRUSH FORMAT }
type mb_fn = string[40];
function read_mb_pic(fn: mb_fn): integer;
var
mb_file: file;
io: integer;
display: array[0..16383] of byte absolute $0B800:$00;
begin
if (pos('.',fn) = 0) then fn := fn + '.MB';
assign(mb_file,fn);
{$I-} reset(mb_file); {$I+}
io := ioresult;
if (io = 0) then begin
{$I-} blockread(mb_file,display,128); {$I+}
io := ioresult;
if (io = 0) then begin
{$I-} close(mb_file); {$I+}
io := ioresult;
end;
end;
read_mb_pic := io;
end;
function write_mb_pic(fn: mb_fn): integer;
var
mb_file: file;
io: integer;
display: array[0..16383] of byte absolute $0B800:$00;
begin
if (pos('.',fn) = 0) then fn := fn + '.MB';
assign(mb_file,fn);
{$I-} rewrite(mb_file); {$I+}
io := ioresult;
if (io = 0) then begin
{$I-} blockwrite(mb_file,display,128); {$I+}
io := ioresult;
if (io = 0) then begin
{$I-} close(mb_file); {$I+}
io := ioresult;
end;
end;
write_mb_pic := io;
end;